package cn.edu.hubu.hubusmartmedicalsystem.controller;


import cn.edu.hubu.hubusmartmedicalsystem.entity.Doctor;
import cn.edu.hubu.hubusmartmedicalsystem.service.DoctorService;
import cn.edu.hubu.hubusmartmedicalsystem.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@CrossOrigin
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    @RequestMapping("/doctor/check")
    public ResultVO check(String account){
        // 调用DoctorService中checkAccount方法进行验证
        ResultVO vo = doctorService.checkAccount(account);
        return vo;
    }

    @RequestMapping("/doctor/regist")
    public ResultVO regist(Doctor doctor){
        ResultVO vo = doctorService.saveDoctor(doctor);
        return vo;
    }

    @RequestMapping("/doctor/login")
    public ResultVO login(String doctorId, String doctorPassword) {
        // 调用 DoctorService 中 loginDoctor 方法进行登录验证
        ResultVO vo = doctorService.loginDoctor(doctorId, doctorPassword);
        return vo;
    }
    @RequestMapping("/doctor/getById")
    public ResultVO getDoctorById(String doctorId){
        ResultVO vo=doctorService.getDoctorById(doctorId);
        return vo;
    }
    @RequestMapping("doctor/getAll")
    public ResultVO getAllDoctor(){
        ResultVO vo=doctorService.getAllDoctor();
        return vo;
    }
    @RequestMapping("doctor/deleteById")
    public ResultVO deleteDoctor(String doctorId){
        ResultVO vo = doctorService.deleteById(doctorId);
        return vo;
    }



}
